package com.lagou.myblog.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 页面加载解析入口
 * Creat by chenZ
 * 2018/1/26
 */
@Controller
@RequestMapping("/api/pub")
public class PageLocationController {
    private static Logger logger = LoggerFactory.getLogger(PageLocationController.class);
    //页面路径参数
    public static final String PAGE_PATH_ATTR = "SYS_PATH_URL_LOCATION";

    @RequestMapping("page.action")
    public String thymeleafLoction(HttpServletRequest request, HttpServletResponse response) throws Exception {
        Object page_url = request.getAttribute(PAGE_PATH_ATTR);
        logger.info("模板解析路径：{}", page_url);
        if (page_url != null)
            return String.valueOf(page_url);
        else
            return "/error";
    }

}



